import 'package:demo/routers/application.dart';
import 'package:flutter/material.dart';

class PinsCellUrl extends StatelessWidget {
  final String url;
  final String urlPic;
  final String urlTitle;

  const PinsCellUrl({Key key, this.url, this.urlPic, this.urlTitle}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: (){
        Application.router.navigateTo(context, "/web?url=${Uri.encodeComponent(url)}&title=${Uri.encodeComponent(urlTitle)}");
      },
      child: Container(
        padding: EdgeInsets.all(10),
        margin: EdgeInsets.symmetric(horizontal: 14, vertical: 10),
        height: 100,
        decoration: BoxDecoration(
          border: Border.all(color: Theme.of(context).accentColor, width: 1),
          borderRadius: BorderRadius.all(Radius.circular(4.0))
        ),
        child: Row(
          children: <Widget>[
            Expanded(
              flex: 2,
              child: Column(
                children: <Widget>[
                  Text(
                    urlTitle,
                    style: TextStyle(fontSize: 19, fontWeight: FontWeight.bold),
                    maxLines: 2,
                    overflow: TextOverflow.ellipsis,
                  ),
                  Text(
                    url,
                    style: TextStyle(fontSize: 15, color: Theme.of(context).accentColor),
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                  )
                ],
              ),
            ),
            Expanded(
              flex: 1,
              child: Image.network(urlPic),
            )
          ],
        ),
      ),
    );
  }
}
